using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;

namespace BO.Admin
{
    public class User_Helper
    {
        public static bool IsLoggedIn(HttpContext current)
        {
            bool result = false;
            try
            {
                result = Convert.ToBoolean(current.Session[PublicConstants.ADMIN_LOGGED_SESSION]);
            }
            catch { }
            return result;
        }
        public static bool IsLoggedIn()
        {
            return IsLoggedIn(HttpContext.Current);
        }
        public static bool PerformLogin(string password)
        {
            if (password == ConfigurationManager.AppSettings["password"])
            {
                HttpContext.Current.Session[PublicConstants.ADMIN_LOGGED_SESSION] = true;
                return true;
            }
            else return false;
        }
        public static void Logout()
        {
            HttpContext.Current.Session.Abandon();
        }
    }
}
